/*
 * @Author: 周海 zhouhaib@yonyou.com
 * @Date: 2022-11-04 20:31:45
 * @LastEditors: 周海 zhouhaib@yonyou.com
 * @LastEditTime: 2022-12-15 12:37:59
 */
import request from '@/utils/request'
import { DictDataDomain } from '@/type.d/system/dictData';

// 查询字典数据列表
export function listDictData(query: DictDataDomain) {
  return request('/system/dictData/list', {
    method: 'get',
    params: query
  })
}

// 查询字典数据详细
export function getDictData(dictCode: string) {
  return request('/system/dictData/' + dictCode, {
    method: 'get'
  })

}


/**
 * 
 * @param dictType 根据多个数据字典类型查询，多个类型用逗号分隔
 * @returns 
 */
export function getDictDatasByDictTypes(dictType: string) {
  return request(`/system/dictData/types/${dictType}`, {
    method: 'GET',
  });
}

/**
* 
* @param dictType 根据单个数据字典类型查询
* @returns 
*/
export function getDictDatasByDictType(dictType: string) {
  return request(`/system/dictData/type/${dictType}`, {
    method: 'GET',
  });
}

// 新增字典数据
export function addDictData(data: DictDataDomain) {
  return request('/system/dictData', {
    method: 'post',
    data: data
  })
}

// 修改字典数据
export function updateDictData(data: DictDataDomain) {
  return request('/system/dictData', {
    method: 'put',
    data: data
  })
}

// 删除字典数据
export function delDictData(dictCode: string) {
  return request('/system/dictData/' + dictCode, {
    method: 'delete'
  })
}
